namespace PMS.Common
{
    using System;
    using System.IO;
    using System.Text;

    public class IniConfig
    {
        private static string sPath = "";

        static IniConfig()
        {
            sPath = Environment.CurrentDirectory + @"\userconfig.ini";
        }

        public static string Read(string section, string key)
        {
            StringBuilder retVal = new StringBuilder(0x400);
            Win32API.GetPrivateProfileString(section, key, "", retVal, 0x400, sPath);
            return retVal.ToString();
        }

        public static void Write(string section, string key, string value)
        {
            if (!File.Exists(sPath))
            {
                File.Create(sPath);
            }
            Win32API.WritePrivateProfileString(section, key, value, sPath);
        }
    }
}

